
#ifndef MAINDIALOG_H
#define MAINDIALOG_H

#include <BSonDocument>
#include <BShortcut>
#include <BButton>
#include <BListWidget>
#include <BLineEdit>
#include <BStatusBar>
#include <BTabWidget>

#include "FileDialog.h"

class MainDialog : public BDialog
{
	BOBJECT(MainDialog);
public:
	MainDialog(BWidget* parent = 0);
	~MainDialog();

	bool openFile(const BString& fileName);
	bool saveFile(const BString& fileName);

protected:
	void signChanged(BWidget* widget, bool changed);

protected:
	void slotOpenButtonClicked(BObject* object, const BValue& value);
	void slotSaveButtonClicked(BObject* object, const BValue& value);
	void slotRevertButtonClicked(BObject* object, const BValue& value);

	void slotListItemClicked(BObject* object, const BValue& value);
	void slotListItemDoubleClicked(BObject* object, const BValue& value);
	void slotListWidgetFreshed(BObject* object, const BValue& value);
	void slotListWidgetFramed(BObject* object, const BValue& value);

	void slotCreateButtonClicked(BObject* object, const BValue& value);
	void slotRemoveButtonClicked(BObject* object, const BValue& value);
	void slotCopyButtonClicked(BObject* object, const BValue& value);
	void slotPasteButtonClicked(BObject* object, const BValue& value);
	void slotItemTextEditFinished(BObject* object, const BValue& value);

	void slotTextEditChanged(BWidget* widget, const BValue& value);

protected:
	virtual void closeEvent(const BEvent& event);

	virtual void styleEvent(const BEvent& event);

private:
	BButton*			_openButton;
	BButton*			_saveButton;
	BButton*			_revertButton;

	BListWidget*		_listWidget;
	BButton*			_createButton;
	BButton*			_removeButton;
	BButton*			_copyButton;
	BButton*			_pasteButton;
	BLineEdit*			_itemLineEdit;

	BTabWidget*			_tabWidget;
	BStatusBar*			_statusBar;
	FileDialog*			_fileDialog;

	BString				_fileName;
	BSonDocument		_document;
};

#endif
